package jwebtester.dal.provider;

import java.util.List;

import org.hibernate.JDBCException;

import domain.entities.Competency;

public interface CompetenciesDataProvider {
	
	List<Competency> getRootCompetencies(int organizationID);

	List<Competency> getCompetencies(int organizationID, int parentID);
	
	/**
	 * Gets full hierarchy of competencies for given organization.
	 * @return Fake root node of hierarchy
	 */
	Competency getHierarchy(int organizationID);
	
	Competency getCompetency(int competencyID);
	
	Competency getCompetencyByName(int organizationID, String name);

	/**
	 * Gets competencies with name like given pattern for given organization
	 */
	List<Competency> getCompetencies(int organizationID, String namePattern);
	
	/**
	 * Saves new competency into database
	 * @return Positive identifier of save object if succeeded
	 * @throws Exception Thrown on errors during saving of new competency
	 */
	int createCompetency(Competency competency) throws JDBCException;
	
	/**
	 * Updates existing competency
	 * @throws Exception Thrown on errors during updating of existing competency
	 */
	void updateCompetency(Competency competency) throws JDBCException;
	
	/**
	 * Removes competency with given identifier from database
	 * @param competencyID
	 * @throws JDBCException Thrown on errors during deletion of competency
	 */
	void deleteCompetency(int competencyID) throws JDBCException;
	
}
